from ultralytics import YOLO

# Load a model
model = YOLO('D:\\py\\work\\yolov8\\runs\detect\\train7\\weights\\best.pt')  # pretrained YOLOv8n model

# Run batched inference on a list of images
results = model('D:\\py\\work\\dataset\\C1C2_v2i_yolov8\\test\\images\\Image_20240508093654454_jpg.rf.f591b47d21faea0c6482aedb3c50f66a.jpg')  # return a list of Results objects

# Process results list
for result in results:
    
    boxes = result.boxes  # Boxes object for bounding box outputs
    masks = result.masks  # Masks object for segmentation masks outputs
    keypoints = result.keypoints  # Keypoints object for pose outputs
    probs = result.probs  # Probs object for classification outputs
    obb = result.obb  # Oriented boxes object for OBB outputs
    print(boxes.data.cpu().numpy())
    # print(probs)
    # result.show()  # display to screen
      # save to disk